<?php
namespace Admin\Controller;

use Think\Controller;

class ImageController extends Controller {
    private $_uploadObj;

    /**
     * ImageController constructor.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 异步上传缩图的方法
     */
    public function ajaxuploadimage()
    {
        $upload = D('UploadImage');
        $res = $upload->imageUpload();
        if($res === false){
            return show(0 , '上传失败' ,'' );
        }else{
            return show(1 , '上传成功' , $res);
        }
    }

    /**
     * 编辑器上传文件
     */
    public function kindupload()
    {
        $upload = D('UploadImage');
        $res = $upload->upload();
        if ($res === false){
            return showKind(1, '上传失败，请重试');
        }
        return showKind(0, $res);
    }
}